import plistlib
import os
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
from Utils.tool import Tool as tool

class stationConfig():

    def __init__(self):
        
        # plistPath = tool().get_resource_path('Station.plist')
        # /Users/annie/Library/Tk/Config


        # self.userName = os.popen("whoami").read()[0:-1]
        # plistPath = "/Users/{}/Library/TkProject/Config/Station.plist".format(self.userName)
        
        # plistPath = "{}/Config/Station.plist".format(tool().getProjectPath())
        plistPath = "{}Config/Station.plist".format(tool().getProjectPath())
        print("plistPath---",plistPath)
        with open(plistPath,'rb') as fp:
            dict = plistlib.load(fp)
            try:
                self.SNInput = dict["SNInput"]
                self.stationName = dict["StationName"]
                self.stationVersion = dict["StationVersion"]
                self.LimitsVersion = dict["LimitsVersion"]
                self.GroupCount = dict["GroupCount"]
                self.isAudit = dict["Audit"]
            except Exception as e:
                print("station config error:",e)
    
    